package zy03;

/**
 * @Author czl
 * @Date 2024-04-07
 */
public class SiYangYuan <A extends Animal>{
    public void weuYang(A a){
        a.eat();
    }

    public void xunCha(A a){
        Class<? extends Animal> clazz = a.getClass();

        if (clazz.isAnnotationPresent(Sleep.class)) {
            Sleep annotation = clazz.getAnnotation(Sleep.class);
            String value = annotation.value();

            if ("失眠".equals(value)){
                System.out.println("给你一颗安眠药");
            }
            System.out.println("继续巡查....");
        }
    }
    public void tiJian(A a){
        Class<? extends Animal> clazz = a.getClass();

        if (clazz.isAnnotationPresent(JianKang.class)) {
            JianKang annotation = clazz.getAnnotation(JianKang.class);
            String value = annotation.value();

            if ("差".equals(value)){
                System.out.println("特殊照顾");
            }
            System.out.println("继续巡查....");
        }
    }
}
